package com.qunar.paydata.platform.service.co;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.qunar.paydata.platform.common.util.ChartUtil;
import com.qunar.paydata.platform.common.util.EmailUtil;
import com.qunar.paydata.platform.common.util.FileUtil;
import com.qunar.paydata.platform.common.util.QunarDateUtil;
import com.qunar.paydata.platform.entity.co.UrlChartCo;
import com.qunar.paydata.platform.entity.co.WSNumChartBaseCo;
import com.qunar.paydata.platform.entity.co.WorksheetBaseCo;
import com.qunar.paydata.platform.entity.co.WorksheetChartCountCo;
import com.qunar.paydata.platform.entity.worksheet.WorksheetBase;
import com.qunar.paydata.platform.service.worksheet.WorksheetService;

/**
 * 
 * 处理前端与后端数据交互（工单信息）
 * 
 * @author leonyang.liu
 *
 */
@Service("worksheetCoService")
public class WorkSheetCoService {
	@Autowired
	private WorksheetService worksheetService;

	/**
	 * 根据查询条件生成工单基本信息页面请求Co
	 */
	public List<WorksheetBaseCo> getWorkSheetBoList(
			Map<String, Object> queryMap) {
		// 一、调用service服务进行查询
		List<WorksheetBase> worksheetBaseList = worksheetService
				.selectByCondition(queryMap);

		// 二、赋值给Co对象
		List<WorksheetBaseCo> worksheetBaseCoList = new ArrayList<WorksheetBaseCo>();
		for (WorksheetBase worksheetBase : worksheetBaseList) {
			WorksheetBaseCo worksheetBaseCo = new WorksheetBaseCo();
			worksheetBaseCo.setId(worksheetBase.getId());
			worksheetBaseCo.setJob_num(worksheetBase.getJob_num());
			worksheetBaseCo
					.setBusiness_type(worksheetBase.getBusiness_type() == 1 ? "机票"
							: worksheetBase.getBusiness_type() == 2 ? "酒店"
									: "类型错误");
			worksheetBaseCo.setCreate_time(QunarDateUtil
					.formatDate(worksheetBase.getCreate_time()));
			worksheetBaseCo
					.setDeal_person((worksheetBase.getDeal_person() == "1" || "1"
							.equals(worksheetBase.getDeal_person())) ? "李成博"
							: (worksheetBase.getDeal_person() == "2" || "2"
									.equals(worksheetBase.getDeal_person())) ? "王进洛"
									: (worksheetBase.getDeal_person() == "3" || "3"
											.equals(worksheetBase
													.getDeal_person())) ? "李瑞昊"
											: (worksheetBase.getDeal_person() == "4" || "4"
													.equals(worksheetBase
															.getDeal_person())) ? "赵佳琪"
													: "处理人不存在");
			if (worksheetBase.getWorksheet_type() == 1) {
				worksheetBaseCo.setWorksheet_type("退款方面");
				if (worksheetBase.getWs_type_detail() == "1"
						|| "1".equals(worksheetBase.getWs_type_detail())) {
					worksheetBaseCo.setWs_type_detail("网关退款");
				}
			}
			if (worksheetBase.getWorksheet_type() == 2) {
				worksheetBaseCo.setWorksheet_type("支付方面");
				if (worksheetBase.getWs_type_detail() == "1"
						|| "1".equals(worksheetBase.getWs_type_detail())) {
					worksheetBaseCo.setWs_type_detail("扣款核实订单");
				}
				if (worksheetBase.getWs_type_detail() == "2"
						|| "2".equals(worksheetBase.getWs_type_detail())) {
					worksheetBaseCo.setWs_type_detail("赔付核实订单");
				}
				if (worksheetBase.getWs_type_detail() == "3"
						|| "3".equals(worksheetBase.getWs_type_detail())) {
					worksheetBaseCo.setWs_type_detail("无法支付");
				}
				if (worksheetBase.getWs_type_detail() == "4"
						|| "4".equals(worksheetBase.getWs_type_detail())) {
					worksheetBaseCo.setWs_type_detail("重复支付");
				}
			}
			if (worksheetBase.getWorksheet_type() == 3) {
				worksheetBaseCo.setWorksheet_type("账户咨询");
				if (worksheetBase.getWs_type_detail() == "1"
						|| "1".equals(worksheetBase.getWs_type_detail())) {
					worksheetBaseCo.setWs_type_detail("查询提现问题");
				}
				if (worksheetBase.getWs_type_detail() == "2"
						|| "2".equals(worksheetBase.getWs_type_detail())) {
					worksheetBaseCo.setWs_type_detail("取消快捷支付");
				}
				if (worksheetBase.getWs_type_detail() == "3"
						|| "3".equals(worksheetBase.getWs_type_detail())) {
					worksheetBaseCo.setWs_type_detail("大额充值问题");
				}
			}
			if (worksheetBase.getWorksheet_type() == 4) {
				worksheetBaseCo.setWorksheet_type("账户返现");
				if (worksheetBase.getWs_type_detail() == "1"
						|| "1".equals(worksheetBase.getWs_type_detail())) {
					worksheetBaseCo.setWs_type_detail("返现问题");
				}
			}
			if (worksheetBase.getWorksheet_type() == 5) {
				worksheetBaseCo.setWorksheet_type("实名问题");
				if (worksheetBase.getWs_type_detail() == "1"
						|| "1".equals(worksheetBase.getWs_type_detail())) {
					worksheetBaseCo.setWs_type_detail("修改实名认证");
				}
				if (worksheetBase.getWs_type_detail() == "2"
						|| "2".equals(worksheetBase.getWs_type_detail())) {
					worksheetBaseCo.setWs_type_detail("绑卡失败");
				}
			}
			if (worksheetBase.getWorksheet_type() == 6) {
				worksheetBaseCo.setWorksheet_type("错误工单");
				if (worksheetBase.getWs_type_detail() == "1"
						|| "1".equals(worksheetBase.getWs_type_detail())) {
					worksheetBaseCo.setWs_type_detail("描述不清晰");
				}
				if (worksheetBase.getWs_type_detail() == "2"
						|| "2".equals(worksheetBase.getWs_type_detail())) {
					worksheetBaseCo.setWs_type_detail("未发起退款");
				}
				if (worksheetBase.getWs_type_detail() == "3"
						|| "3".equals(worksheetBase.getWs_type_detail())) {
					worksheetBaseCo.setWs_type_detail("百度LBS自有订单");
				}
				if (worksheetBase.getWs_type_detail() == "4"
						|| "4".equals(worksheetBase.getWs_type_detail())) {
					worksheetBaseCo.setWs_type_detail("提供信息不全面");
				}
				if (worksheetBase.getWs_type_detail() == "5"
						|| "5".equals(worksheetBase.getWs_type_detail())) {
					worksheetBaseCo.setWs_type_detail("提现审核拒绝");
				}
				if (worksheetBase.getWs_type_detail() == "6"
						|| "6".equals(worksheetBase.getWs_type_detail())) {
					worksheetBaseCo.setWs_type_detail("支付日志已有明确支付退款信息");
				}
				if (worksheetBase.getWs_type_detail() == "7"
						|| "7".equals(worksheetBase.getWs_type_detail())) {
					worksheetBaseCo.setWs_type_detail("非支付中心工单");
				}
				if (worksheetBase.getWs_type_detail() == "8"
						|| "8".equals(worksheetBase.getWs_type_detail())) {
					worksheetBaseCo.setWs_type_detail("提现、返现等金额不符");
				}
				if (worksheetBase.getWs_type_detail() == "9"
						|| "9".equals(worksheetBase.getWs_type_detail())) {
					worksheetBaseCo.setWs_type_detail("重复转单");
				}
			}
			if (worksheetBase.getWorksheet_type() == 7) {
				worksheetBaseCo.setWorksheet_type("其他");
				if (worksheetBase.getWs_type_detail() == "1"
						|| "1".equals(worksheetBase.getWs_type_detail())) {
					worksheetBaseCo.setWs_type_detail("其他");
				}
			}
			worksheetBaseCo.setWs_comment(worksheetBase.getWs_comment());
			worksheetBaseCo.setUpdate_time(QunarDateUtil
					.formatDate(worksheetBase.getUpdate_time()));
			worksheetBaseCoList.add(worksheetBaseCo);
		}
		return worksheetBaseCoList;
	}

	/**
	 * 根据查询条件生成工单基本信息页面请求Co
	 */
	public WorksheetChartCountCo getWorksheetChartCount(
			Map<String, Object> conditionMap) {
		WorksheetChartCountCo worksheetChartCount = new WorksheetChartCountCo();
		// 查询总数
		int total = worksheetService.selectChartByCondition(conditionMap);
		// 查询具体内容(并进行清算)
		// 清算内容如下
		int desc_unclear = 0;
		int no_refund = 0;
		int baidu_order = 0;
		int dup_trans = 0;
		int info_incomplete = 0;
		int rejection_present = 0;
		int cleared_refund = 0;
		int no_paycenter_order = 0;
		int amount_differ = 0;
		int ws_other = 0;
		int card_failure = 0;
		int modify_realname_auth = 0;
		int gateway_refund = 0;
		int query_present = 0;
		int quick_pay_cancel = 0;
		int large_recharge = 0;
		int chargeback_order = 0;
		int payment_order_verf = 0;
		int unable_topay = 0;
		int repeated_payment = 0;
		int return_problem = 0;
		int wrong_worksheet = 0;
		int other_total = 0;
		int realname_prob = 0;
		int refund_problem = 0;
		int accunt_consult = 0;
		int payment_aspect = 0;
		int consult_return = 0;

		List<WorksheetBase> worksheetBaseList = worksheetService
				.selectByCondition(conditionMap);
		for (WorksheetBase worksheetBase : worksheetBaseList) {
			if (worksheetBase.getWorksheet_type() == 1) {
				refund_problem++;
				if (worksheetBase.getWs_type_detail() == "1"
						|| "1".equals(worksheetBase.getWs_type_detail())) {
					gateway_refund++;
				}
			}
			if (worksheetBase.getWorksheet_type() == 2) {
				payment_aspect++;
				if (worksheetBase.getWs_type_detail() == "1"
						|| "1".equals(worksheetBase.getWs_type_detail())) {
					chargeback_order++;
				}
				if (worksheetBase.getWs_type_detail() == "2"
						|| "2".equals(worksheetBase.getWs_type_detail())) {
					payment_order_verf++;
				}
				if (worksheetBase.getWs_type_detail() == "3"
						|| "3".equals(worksheetBase.getWs_type_detail())) {
					unable_topay++;
				}
				if (worksheetBase.getWs_type_detail() == "4"
						|| "4".equals(worksheetBase.getWs_type_detail())) {
					repeated_payment++;
				}
			}
			if (worksheetBase.getWorksheet_type() == 3) {
				accunt_consult++;
				if (worksheetBase.getWs_type_detail() == "1"
						|| "1".equals(worksheetBase.getWs_type_detail())) {
					query_present++;
				}
				if (worksheetBase.getWs_type_detail() == "2"
						|| "2".equals(worksheetBase.getWs_type_detail())) {
					quick_pay_cancel++;
				}
				if (worksheetBase.getWs_type_detail() == "3"
						|| "3".equals(worksheetBase.getWs_type_detail())) {
					large_recharge++;
				}
			}
			if (worksheetBase.getWorksheet_type() == 4) {
				consult_return++;
				if (worksheetBase.getWs_type_detail() == "1"
						|| "1".equals(worksheetBase.getWs_type_detail())) {
					return_problem++;
				}
			}
			if (worksheetBase.getWorksheet_type() == 5) {
				realname_prob++;
				if (worksheetBase.getWs_type_detail() == "1"
						|| "1".equals(worksheetBase.getWs_type_detail())) {
					modify_realname_auth++;
				}
				if (worksheetBase.getWs_type_detail() == "2"
						|| "2".equals(worksheetBase.getWs_type_detail())) {
					card_failure++;
				}
			}
			if (worksheetBase.getWorksheet_type() == 6) {
				wrong_worksheet++;
				if (worksheetBase.getWs_type_detail() == "1"
						|| "1".equals(worksheetBase.getWs_type_detail())) {
					desc_unclear++;
				}
				if (worksheetBase.getWs_type_detail() == "2"
						|| "2".equals(worksheetBase.getWs_type_detail())) {
					no_refund++;
				}
				if (worksheetBase.getWs_type_detail() == "3"
						|| "3".equals(worksheetBase.getWs_type_detail())) {
					baidu_order++;
				}
				if (worksheetBase.getWs_type_detail() == "4"
						|| "4".equals(worksheetBase.getWs_type_detail())) {
					info_incomplete++;
				}
				if (worksheetBase.getWs_type_detail() == "5"
						|| "5".equals(worksheetBase.getWs_type_detail())) {
					rejection_present++;
				}
				if (worksheetBase.getWs_type_detail() == "6"
						|| "6".equals(worksheetBase.getWs_type_detail())) {
					cleared_refund++;
				}
				if (worksheetBase.getWs_type_detail() == "7"
						|| "7".equals(worksheetBase.getWs_type_detail())) {
					no_paycenter_order++;
				}
				if (worksheetBase.getWs_type_detail() == "8"
						|| "8".equals(worksheetBase.getWs_type_detail())) {
					amount_differ++;
				}
				if (worksheetBase.getWs_type_detail() == "9"
						|| "9".equals(worksheetBase.getWs_type_detail())) {
					dup_trans++;
				}
			}
			if (worksheetBase.getWorksheet_type() == 7) {
				other_total++;
				if (worksheetBase.getWs_type_detail() == "1"
						|| "1".equals(worksheetBase.getWs_type_detail())) {
					ws_other++;
				}
			}
		}
		// 给co模型赋值。传给前端
		worksheetChartCount.setAccunt_consult(accunt_consult);
		worksheetChartCount.setAmount_differ(amount_differ);
		worksheetChartCount.setBaidu_order(baidu_order);
		worksheetChartCount.setCard_failure(card_failure);
		worksheetChartCount.setChargeback_order(chargeback_order);
		worksheetChartCount.setCleared_refund(cleared_refund);
		worksheetChartCount.setConsult_return(consult_return);
		worksheetChartCount.setDesc_unclear(desc_unclear);
		worksheetChartCount.setDup_trans(dup_trans);
		worksheetChartCount.setGateway_refund(gateway_refund);
		worksheetChartCount.setInfo_incomplete(info_incomplete);
		worksheetChartCount.setLarge_recharge(large_recharge);
		worksheetChartCount.setModify_realname_auth(modify_realname_auth);
		worksheetChartCount.setNo_paycenter_order(no_paycenter_order);
		worksheetChartCount.setNo_refund(no_refund);
		worksheetChartCount.setOther_total(other_total);
		worksheetChartCount.setPayment_aspect(payment_aspect);
		worksheetChartCount.setPayment_order_verf(payment_order_verf);
		worksheetChartCount.setQuery_present(query_present);
		worksheetChartCount.setQuick_pay_cancel(quick_pay_cancel);
		worksheetChartCount.setRealname_prob(realname_prob);
		worksheetChartCount.setRefund_problem(refund_problem);
		worksheetChartCount.setRejection_present(rejection_present);
		worksheetChartCount.setRepeated_payment(repeated_payment);
		worksheetChartCount.setReturn_problem(return_problem);
		worksheetChartCount.setTotal(total);
		worksheetChartCount.setUnable_topay(unable_topay);
		worksheetChartCount.setWrong_worksheet(wrong_worksheet);
		worksheetChartCount.setWs_other(ws_other);
		return worksheetChartCount;
	}

	/**
	 * 根据查询条件生成日报报表工单数，并生成报表图片
	 */
	public String getWSChartCount(Map<String, Object> conditionMap,
			HttpSession session) {
		WSNumChartBaseCo wsNumChartBaseCo = new WSNumChartBaseCo();
		// 查询具体内容(并进行清算)
		// 清算内容如下
		/**
		 * 李瑞昊工单数
		 */
		double wrong_worksheet_lrh = 0;
		double other_lrh = 0;
		double realname_lrh = 0;
		double refund_lrh = 0;
		double accunt_consult_lrh = 0;
		double payment_aspect_lrh = 0;
		double consult_return_lrh = 0;
		double total_lrh = 0;
		/**
		 * 李成博工单数
		 */
		double wrong_worksheet_lcb = 0;
		double other_lcb = 0;
		double realname_lcb = 0;
		double refund_lcb = 0;
		double accunt_consult_lcb = 0;
		double payment_aspect_lcb = 0;
		double consult_return_lcb = 0;
		double total_lcb = 0;
		/**
		 * 王进洛工单数
		 */
		double wrong_worksheet_wjl = 0;
		double other_wjl = 0;
		double realname_wjl = 0;
		double refund_wjl = 0;
		double accunt_consult_wjl = 0;
		double payment_aspect_wjl = 0;
		double consult_return_wjl = 0;
		double total_wjl = 0;

		/**
		 * 赵佳琪工单数
		 */
		double wrong_worksheet_zjq = 0;
		double other_zjq = 0;
		double realname_zjq = 0;
		double refund_zjq = 0;
		double accunt_consult_zjq = 0;
		double payment_aspect_zjq = 0;
		double consult_return_zjq = 0;
		double total_zjq = 0;
		// 查询日报报表（一天内）
		List<WorksheetBase> worksheetBaseList = worksheetService
				.selectByCondition(conditionMap);
		for (WorksheetBase worksheetBase : worksheetBaseList) {
			if (worksheetBase.getWorksheet_type() == 1) {
				if (worksheetBase.getDeal_person() == "1"
						|| "1".equals(worksheetBase.getDeal_person())) {
					refund_lcb++;
				}
				if (worksheetBase.getDeal_person() == "2"
						|| "2".equals(worksheetBase.getDeal_person())) {
					refund_wjl++;
				}
				if (worksheetBase.getDeal_person() == "3"
						|| "3".equals(worksheetBase.getDeal_person())) {
					refund_lrh++;
				}
				if (worksheetBase.getDeal_person() == "4"
						|| "4".equals(worksheetBase.getDeal_person())) {
					refund_zjq++;
				}
			}
			if (worksheetBase.getWorksheet_type() == 2) {
				if (worksheetBase.getDeal_person() == "1"
						|| "1".equals(worksheetBase.getDeal_person())) {
					payment_aspect_lcb++;
				}
				if (worksheetBase.getDeal_person() == "2"
						|| "2".equals(worksheetBase.getDeal_person())) {
					payment_aspect_wjl++;
				}
				if (worksheetBase.getDeal_person() == "3"
						|| "3".equals(worksheetBase.getDeal_person())) {
					payment_aspect_lrh++;
				}
				if (worksheetBase.getDeal_person() == "4"
						|| "4".equals(worksheetBase.getDeal_person())) {
					payment_aspect_zjq++;
				}
			}
			if (worksheetBase.getWorksheet_type() == 3) {
				if (worksheetBase.getDeal_person() == "1"
						|| "1".equals(worksheetBase.getDeal_person())) {
					accunt_consult_lcb++;
				}
				if (worksheetBase.getDeal_person() == "2"
						|| "2".equals(worksheetBase.getDeal_person())) {
					accunt_consult_wjl++;
				}
				if (worksheetBase.getDeal_person() == "3"
						|| "3".equals(worksheetBase.getDeal_person())) {
					accunt_consult_lrh++;
				}
				if (worksheetBase.getDeal_person() == "4"
						|| "4".equals(worksheetBase.getDeal_person())) {
					accunt_consult_zjq++;
				}
			}
			if (worksheetBase.getWorksheet_type() == 4) {
				if (worksheetBase.getDeal_person() == "1"
						|| "1".equals(worksheetBase.getDeal_person())) {
					consult_return_lcb++;
				}
				if (worksheetBase.getDeal_person() == "2"
						|| "2".equals(worksheetBase.getDeal_person())) {
					consult_return_wjl++;
				}
				if (worksheetBase.getDeal_person() == "3"
						|| "3".equals(worksheetBase.getDeal_person())) {
					consult_return_lrh++;
				}
				if (worksheetBase.getDeal_person() == "4"
						|| "4".equals(worksheetBase.getDeal_person())) {
					consult_return_zjq++;
				}
			}
			if (worksheetBase.getWorksheet_type() == 5) {
				if (worksheetBase.getDeal_person() == "1"
						|| "1".equals(worksheetBase.getDeal_person())) {
					realname_lcb++;
				}
				if (worksheetBase.getDeal_person() == "2"
						|| "2".equals(worksheetBase.getDeal_person())) {
					realname_wjl++;
				}
				if (worksheetBase.getDeal_person() == "3"
						|| "3".equals(worksheetBase.getDeal_person())) {
					realname_lrh++;
				}
				if (worksheetBase.getDeal_person() == "4"
						|| "4".equals(worksheetBase.getDeal_person())) {
					realname_zjq++;
				}
			}
			if (worksheetBase.getWorksheet_type() == 6) {
				if (worksheetBase.getDeal_person() == "1"
						|| "1".equals(worksheetBase.getDeal_person())) {
					wrong_worksheet_lcb++;
				}
				if (worksheetBase.getDeal_person() == "2"
						|| "2".equals(worksheetBase.getDeal_person())) {
					wrong_worksheet_wjl++;
				}
				if (worksheetBase.getDeal_person() == "3"
						|| "3".equals(worksheetBase.getDeal_person())) {
					wrong_worksheet_lrh++;
				}
				if (worksheetBase.getDeal_person() == "4"
						|| "4".equals(worksheetBase.getDeal_person())) {
					wrong_worksheet_zjq++;
				}
			}
			if (worksheetBase.getWorksheet_type() == 7) {
				if (worksheetBase.getDeal_person() == "1"
						|| "1".equals(worksheetBase.getDeal_person())) {
					other_lcb++;
				}
				if (worksheetBase.getDeal_person() == "2"
						|| "2".equals(worksheetBase.getDeal_person())) {
					other_wjl++;
				}
				if (worksheetBase.getDeal_person() == "3"
						|| "3".equals(worksheetBase.getDeal_person())) {
					other_lrh++;
				}
				if (worksheetBase.getDeal_person() == "4"
						|| "4".equals(worksheetBase.getDeal_person())) {
					other_zjq++;
				}

			}
		}
		// 查询区间没人对应工单数(删除initTim，用于区间查询)
		conditionMap.remove("initTim");
		// conditionMap.put("initTim", "0");
		List<WorksheetBase> wsBaseList = worksheetService
				.selectByCondition(conditionMap);
		for (WorksheetBase worksheetBase : wsBaseList) {
			if ("1".equals(worksheetBase.getDeal_person())
					|| worksheetBase.getDeal_person() == "1") {
				total_lcb++;
			}
			if ("2".equals(worksheetBase.getDeal_person())
					|| worksheetBase.getDeal_person() == "1") {
				total_wjl++;
			}
			if ("3".equals(worksheetBase.getDeal_person())
					|| worksheetBase.getDeal_person() == "1") {
				total_lrh++;
			}
			if ("4".equals(worksheetBase.getDeal_person())
					|| worksheetBase.getDeal_person() == "1") {
				total_zjq++;
			}
		}
		// 设置值
		wsNumChartBaseCo.setAccunt_consult_lcb(accunt_consult_lcb);
		wsNumChartBaseCo.setAccunt_consult_lrh(accunt_consult_lrh);
		wsNumChartBaseCo.setAccunt_consult_wjl(accunt_consult_wjl);
		wsNumChartBaseCo.setAccunt_consult_zjq(accunt_consult_zjq);
		wsNumChartBaseCo.setConsult_return_lcb(consult_return_lcb);
		wsNumChartBaseCo.setConsult_return_lrh(consult_return_lrh);
		wsNumChartBaseCo.setConsult_return_wjl(consult_return_wjl);
		wsNumChartBaseCo.setConsult_return_zjq(consult_return_zjq);
		wsNumChartBaseCo.setOther_lcb(other_lcb);
		wsNumChartBaseCo.setOther_lrh(other_lrh);
		wsNumChartBaseCo.setOther_wjl(other_wjl);
		wsNumChartBaseCo.setOther_zjq(other_zjq);
		wsNumChartBaseCo.setPayment_aspect_lcb(payment_aspect_lcb);
		wsNumChartBaseCo.setPayment_aspect_lrh(payment_aspect_lrh);
		wsNumChartBaseCo.setPayment_aspect_wjl(payment_aspect_wjl);
		wsNumChartBaseCo.setPayment_aspect_zjq(payment_aspect_zjq);
		wsNumChartBaseCo.setRealname_lcb(realname_lcb);
		wsNumChartBaseCo.setRealname_lrh(realname_lrh);
		wsNumChartBaseCo.setRealname_wjl(realname_wjl);
		wsNumChartBaseCo.setRealname_zjq(realname_zjq);
		wsNumChartBaseCo.setRefund_lcb(refund_lcb);
		wsNumChartBaseCo.setRefund_lrh(refund_lrh);
		wsNumChartBaseCo.setRefund_wjl(refund_wjl);
		wsNumChartBaseCo.setRefund_zjq(refund_zjq);
		wsNumChartBaseCo.setTotal_lcb(total_lcb);
		wsNumChartBaseCo.setTotal_lrh(total_lrh);
		wsNumChartBaseCo.setTotal_wjl(total_wjl);
		wsNumChartBaseCo.setTotal_zjq(total_zjq);
		wsNumChartBaseCo.setWrong_worksheet_lcb(wrong_worksheet_lcb);
		wsNumChartBaseCo.setWrong_worksheet_lrh(wrong_worksheet_lrh);
		wsNumChartBaseCo.setWrong_worksheet_wjl(wrong_worksheet_wjl);
		wsNumChartBaseCo.setWrong_worksheet_zjq(wrong_worksheet_zjq);
		//总单数
		Double totalNum = accunt_consult_lcb+accunt_consult_lrh+accunt_consult_wjl+accunt_consult_zjq+
				consult_return_lcb+consult_return_lrh+consult_return_wjl+consult_return_zjq+
				other_lcb+other_lrh+other_wjl+other_zjq+
				payment_aspect_lcb+payment_aspect_lrh+payment_aspect_wjl+payment_aspect_zjq+
				realname_lcb+realname_lrh+realname_wjl+realname_zjq+
				refund_lcb+refund_lrh+refund_wjl+refund_zjq+
				wrong_worksheet_lcb+wrong_worksheet_lrh+wrong_worksheet_wjl+wrong_worksheet_zjq;
		// 清空图表生成目录下的文件
		String file_path = session.getServletContext().getRealPath("/")
				+ "images/chart/";
		FileUtil.emptyFileFoder(file_path);
		String random_1 = "0";
		String random_2 = "0";
		// 生成日报报表（
		random_1 = ChartUtil.genPayCentreReport(wsNumChartBaseCo, session,(String)conditionMap.get("endDate"),totalNum);
		// 生成工单数报表取开始时间和结束时间作为报表头部信息）
		String begin = (String)conditionMap.get("beginDate");
		String end = (String)conditionMap.get("endDate");
		String beginDate = begin.split("-")[0]+"年"+begin.split("-")[1]+"月"+begin.split("-")[2]+"日";
		String endDate = end.split("-")[0]+"年"+end.split("-")[1]+"月"+end.split("-")[2]+"日";
		random_2 = ChartUtil.genWorksheetNum(wsNumChartBaseCo, session,beginDate,endDate);
		return random_1 + "_" + random_2;
	}
	/**
	 * 电子邮件发送报表信息
	 * @throws Exception 
	 */
	public void sendChartEmail(String chart_comment,String random_1,String random_2,HttpSession session) throws Exception{
		EmailUtil.createEmail(chart_comment,random_1,random_2,session);
	}
}
